package demo.cmd;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpStatus;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * @author : GuoFei
 * @date : 2019/1/19 16:57
 */
public class RunTimeUtil {
    public static void main(String[] args) {
//        String cmd = "cmd /k start D:\\apache-activemq-5.15.0\\bin\\win64\\activemq.bat";// pass
        Runtime rt = Runtime.getRuntime(); //返回当前应用程序的Runtime对象
        Process ps = null;//制子进程的执行或获取该子进程的信息
        try {
//            ps = rt.exec("cmd.exe /c start D:\\apache-activemq-5.15.0\\bin\\win64\\activemq.bat");//这里的C:\\Users\\qiang\\Desktop\\restartTomct.bat 换成你自己的bat文件的绝对路径
//            InputStream inputStream = ps.getInputStream();
            System.out.println(IOUtils.DIR_SEPARATOR_UNIX);
            System.out.println(IOUtils.LINE_SEPARATOR_UNIX);
            System.out.println(IOUtils.DIR_SEPARATOR_WINDOWS);
            System.out.println(IOUtils.LINE_SEPARATOR_WINDOWS);

            System.out.println(Integer.MAX_VALUE);
            System.out.println(Integer.MIN_VALUE);

            System.out.println(StandardCharsets.UTF_8);
            System.out.println(StandardCharsets.US_ASCII);
            System.out.println(StandardCharsets.ISO_8859_1);
            System.out.println(StandardCharsets.UTF_16BE);
            System.out.println(StandardCharsets.UTF_16LE);
            System.out.println(StandardCharsets.UTF_16);

            System.out.println(HttpStatus.SC_OK);
            System.out.println(HttpStatus.SC_MOVED_PERMANENTLY);
            System.out.println(HttpStatus.SC_BAD_REQUEST);
            System.out.println(HttpStatus.SC_NOT_FOUND);
            System.out.println(HttpStatus.SC_FORBIDDEN);
            System.out.println(HttpStatus.SC_INTERNAL_SERVER_ERROR);

            System.out.println(Boolean.TRUE);
            System.out.println(Boolean.FALSE);

            String message = new String(IOUtils.toByteArray(new FileInputStream("C:\\Users\\mayn\\Desktop\\顶顶顶顶.txt")));
            String messaga = FileUtils.readFileToString(new File("C:\\Users\\mayn\\Desktop\\顶顶顶顶.txt"), StandardCharsets.UTF_8);
            System.out.println(message);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
